package com.tjh.gulimall.cart.service;

import com.tjh.gulimall.cart.vo.Cart;
import com.tjh.gulimall.cart.vo.CartItem;

import java.util.List;
import java.util.concurrent.ExecutionException;

/**
 * Create by koala on 2021-05-16
 */
public interface CartService {

    /**
     * day105：将商品添加到购物车
     */
    CartItem addToCart(Long skuId, Integer num) throws ExecutionException, InterruptedException;

    /**
     * day107：获取用户购物车数据
     */
    Cart getCart() throws ExecutionException, InterruptedException;

    /**
     * day107：清空购物车数据
     */
    void clearCart(String cartKey);


    /**
     * day108：勾选购物项
     */
    void checkItem(Long skuId, Integer check);

    /**
     * day109：修改购物项数量
     */
    void changeItemCount(Long skuId, Integer num);

    /**
     * day110：删除购物项
     */
    void deleteItem(Long skuId);

    /**
     * day106：获取购物车中某个购物项
     */
    CartItem getCartItem(Long skuId);

    /**
     * day117：获取用户的购物项
     */
    List<CartItem> getUserCartItems();

}
